package com.rq.demo.net;

import com.rq.base.BASE;
import com.rq.base.net.HTTP;
import com.rq.base.net.HttpThreadManager;
import com.rq.base.ui.impl.BaseView;
import com.rq.demo.bean.BaseBean;
import com.rq.demo.bean.TestBean;

import java.util.HashMap;
import java.util.Map;

public class HttpManager {
    private static String head = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoiNmQ1OGViNjYxNjM4NDEwZDg2NjYwYzUzZjk3NGNjM2EiLCJ1c2VyX2tleSI6IjgxMzUxNDk1LTg1YzItNDYzMS1hNTM5LTRjY2NjOTRlN2U0YiIsInVzZXJuYW1lIjoiMTIifQ.o80ZqIqCRinXde3BvF4w9slGq78wXUrugl5l-G8NI9uPmh_eLw9XnyDRxEMtPJs3XYhqF4f6s9xDz5i677c4sA";


    public static void test(BaseView view) {
        Map<String, Object> params = new HashMap<>();
        params.put("[Authorization", head);
        HTTP.get().get(Constants.NET_CODE.test, params, TestBean.class, view);
    }

    public static void testPost(BaseView view) {
        Map<String, Object> params = new HashMap<>();
        params.put("[Authorization", head);
        String cardNo = "浙123457";
        params.put("carNo", cardNo);
        HTTP.get().post(Constants.NET_CODE.testPOST, params, BaseBean.class, view);
    }

    public static void testDownload(HttpThreadManager.DownListener downListener) {
        String url = "http://nos.netease.com/lofter/lofter.apk";
        HTTP.get().download(url, BASE.getBaseDir() + "/" + "download/loft.apk", null, downListener);
    }
}
